package com.cqvie.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;

@Entity
public class AttendDetails {
	private String ID;// 考勤明细ID
	private String stuID; // 学号
	private String stuName; // 学生姓名
	private String attendType; // 考勤结果
	private String a_mark; // 是否已请假的标记

	private Attend attend;

	private Set<Student> student = new HashSet<Student>();

	public String getA_mark() {
		return a_mark;
	}

	@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name="attend_ID")  //考勤ID
	public Attend getAttend() {
		return attend;
	}

	public String getAttendType() {
		return attendType;
	}

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public String getID() {
		return ID;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "attendDetails_student", // 中间表
	joinColumns = { @JoinColumn(name = "attendDetailsID", referencedColumnName = "ID") }, inverseJoinColumns = { @JoinColumn(name = "stuID", referencedColumnName = "studentID") })
	public Set<Student> getStudent() {
		return student;
	}

	public String getStuID() {
		return stuID;
	}

	public String getStuName() {
		return stuName;
	}

	public void setA_mark(String a_mark) {
		this.a_mark = a_mark;
	}

	public void setAttend(Attend attend) {
		this.attend = attend;
	}

	public void setAttendType(String attendType) {
		this.attendType = attendType;
	}

	public void setID(String iD) {
		ID = iD;
	}

	public void setStudent(Set<Student> student) {
		this.student = student;
	}

	public void setStuID(String stuID) {
		this.stuID = stuID;
	}

	public void setStuName(String stuName) {
		this.stuName = stuName;
	}

}
